from django.contrib.auth.models import AbstractUser
from django.db import models

# Create your models here.
# 重写django的user模型
class User(AbstractUser):
    tel = models.CharField(max_length=11,
                           unique=True,
                           verbose_name='手机号',
                           blank=True,
                           null=True
                           )
    head_img = models.ImageField(default='static/images/default.jpg',
                                 upload_to="images/",
                                 blank=True,
                                 null=True,
                                 verbose_name='头像'
                                 )
    nickname = models.CharField(max_length=11,
                                verbose_name='用户昵称',
                                blank=True,
                                null=True)
    email = models.EmailField(verbose_name='用户邮箱',
                              unique=True,
                              blank=True,
                              null=True,
                              default=None
                              )

    def __str__(self):
        return self.username